/****************************************************************************
** @brief
****************************************************************************/

#ifndef CARDZLG_H
#define CARDZLG_H

#include "abstractCard.h"

class CardZlg : public AbstractCard
{
    Q_OBJECT

public:
    ///
    /// \brief The CardClass enum
    ///
    enum CardClass {
        kMifare = 0x02,
    };

    ///
    /// \brief The CardCmd enum
    ///
    enum CardCmd {
        kMFAuthent = 'F',         /* 直接密钥验证 */
        kReadM1DataBlock = 'G',   /* Mifare卡读 */
        kActionCard = 'M',        /* 卡激活（请求、防碰撞和选择三条命令的组合） */
    };

    CardZlg(enum CardType cardType, QObject *parent = nullptr);
    ~CardZlg();

    virtual void TestSerial();

protected:

private:
    enum CardCmd cmd_code_;

    ///
    /// \brief Construct 构造数据
    /// \param cmd_class
    /// \param cmd_code
    /// \return
    ///
    QByteArray Construct(enum CardClass cmd_class, enum CardCmd cmd_code);

    ///
    /// \brief CalcSum
    /// \param data
    /// \param len
    /// \return
    ///
    unsigned int CalcSum(unsigned char *data, unsigned int len);

signals:

public slots:
    virtual void SearchCard();

private slots:
    void HandleSerialData();
};

#endif // CARDZLG_H
